<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>水平垂直居中</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        span {
            width: 100px;
            height: 100px;
            background-color: pink;
            display: inline-block;
            /* 法1 */
            /* text-align: center;
            line-height: 100px; */
            /* 法2 */
            display: flex;
            justify-content: center;
            align-items: center;

        }
    </style>
</head>
<body>
    <span>完美世界</span>
</body>
</html>